<template>
    <div>
      <div class="ser_input">
        <img :src="'./static/lyl/search.png'" alt="">
        <input v-on:input="searchFn()" type="text" placeholder="搜索名称和编号" v-model="keyword">
      </div>
      <ul class="Sho_ul">
        <li v-for="(item,index) in videoData" :key="index">
          <div class="img">
            <img :src="item.thumb" alt="数据加载失败">
            <img @click="playVideo(item)" :src="'./static/lyl/video.png'" alt="">
          </div>
          <p>{{item.video_title}}</p>
        </li>
      </ul>

      <ul class="ul2">
        <li v-for="(item,index) in data" :key="index">
          <router-link :to="item.path" :class="$route.params.id2==index?'acti':''">
            {{item.txt}}<p v-if="$route.params.id2==index"></p>
          </router-link>
        </li>
      </ul>
    </div>
</template>

<script>
  import * as list from "../../../api/list.js";
    export default {
      name: "Showout",
      data(){
        return {
          keyword:'',
          videoData:[],
          data:[
            {path:'/vote/4/showout/0/'+this.$route.params.id3,txt:'首页'},
            {path:'/vote/4/ranking/1/'+this.$route.params.id3,txt:'人气排行'},
            {path:'/vote/4/voting/2/'+this.$route.params.id3,txt:'投票说明'}
          ]
        }
      },
      beforeMount(){
        let parmes5 = {active_id:this.$route.params.id3};
        list.videoSearch(parmes5).then(res=>{
          console.log('首页视频列表',res);
          this.videoData = res.data
        })
      },
      mounted(){
        mui.back = function() {
          window.history.go(-1);
        }
      },
      methods:{
        searchFn(){
          let parmes5 = {keyword:this.keyword};
          list.videoSearch(parmes5).then(res=>{
            console.log('搜索视频列表',res);
            this.videoData = res.data;
          })
        },
        playVideo(item){
          this.$router.push('/video2/'+item.id+'/'+this.$route.params.id3)
        }
      }
    }
</script>

<style scoped>
  .ser_input{
    margin-top: 20px;
    box-sizing: border-box;
    position: relative;
  }
  .ser_input input{
    -webkit-box-sizing:border-box;
    box-sizing: border-box;
    width: 100%;
    border: 2px solid #dcdcdc;
    padding: 13px 0 13px 82px;
    font-size: 28px;
    color: #8c8c8c;
    border-radius: 30px;
  }
  .ser_input img{
    position: absolute;
    left: 23px;
    top: 13px;
    width: 32px;
  }
  .Sho_ul{
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 20px 40px;
  }
  .Sho_ul li{
    width: 320px;
    overflow: hidden;
  }
  .Sho_ul li .img{
    width: 320px;
    height: 200px;
    background: #dcdcdc;
    position: relative;
  }
  .Sho_ul li .img img:nth-child(1){
    width: 320px;
    height: 200px;
  }
  .Sho_ul li .img img:nth-child(2){
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 54px;
  }
  .Sho_ul li p{
    font-size: 28px;
    padding: 20px 0;
    text-align: center;
  }

  .ul2{
    display: flex;
    justify-content: space-between;
  }
  .ul2 li{
    position: relative;
    flex-grow: 1;
    font-size: 26px;
    border-right: 1px solid #444;
    text-align: center;
  }
  .ul2 .acti{
    color: #884ca4;
  }
  .ul2 li p{
    position: absolute;
    left: 50%;
    margin-left: -52px;
    bottom: -20px;
    width: 104px;
    border: 4px solid #884ca4;
  }
  .ul2 li:last-child{
    border: none;
  }
</style>
